#include <iostream>
#include <string>
#include "GL/freeglut.h"

using namespace std;

void DrawTri()
{
	glVertex3f(-0.5, -0.5, 0.0);
	glVertex3f(0.5, 0.0, 0.0);
	glVertex3f(0.0, 0.5, 0.0);
}

void Render( void )
{
	glClear(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT);

	glBegin(GL_TRIANGLES);
	
		DrawTri();
	
	glEnd();

	glutSwapBuffers();
}

int main(int argc, char** argv)
{
	glutInit(&argc, argv);
	glutInitWindowSize(600, 480);
	glutInitWindowPosition(50, 50);
	glutInitDisplayMode(GLUT_RGBA | GLUT_DOUBLE | GLUT_DEPTH);
	glutCreateWindow("Some window eh?");
	glutDisplayFunc(*Render);
	
	glutMainLoop();
	return 0;
}



//// T0yK4T.cpp : Defines the entry point for the console application.
////
//
//#define WIN32_LEAN_AND_MEAN	
//#pragma comment(linker, "/subsystem:windows")
//
//#include <iostream>
//#include <string>
//#include <Windows.h>
//
//using namespace std;
//
//LRESULT CALLBACK wndproc(HWND wnd, UINT message, WPARAM wParam, LPARAM lParam)
//{
//	static HGLRC renderingContext;
//	static HDC deviceContext;
//	switch (message)
//	{
//		case WM_CREATE:
//			deviceContext = GetDC(wnd);
//			renderingContext = wglCreateContext(deviceContext);
//			wglMakeCurrent(deviceContext, renderingContext);
//			break;
//		case WM_DESTROY:
//			wglMakeCurrent(deviceContext, NULL);
//			wglDeleteContext(renderingContext);
//			PostQuitMessage(0);
//			break;
//		default:
//			break;
//	}
//	return DefWindowProc(wnd, message, wParam, lParam);
//}
//
//int APIENTRY WinMain(HINSTANCE hInstance,
//                     HINSTANCE hPrevInstance,
//                     LPSTR     lpCmdLine,
//                     int       nCmdShow)
//{	
//	WNDCLASSEX windowClass;
//	HWND wnd;
//	MSG msg;
//	bool done;
//	windowClass.cbSize = sizeof(WNDCLASSEX);
//	windowClass.style = CS_HREDRAW | CS_VREDRAW;
//	windowClass.lpfnWndProc = wndproc;
//	windowClass.cbClsExtra = 0;
//	windowClass.cbWndExtra = 0;
//	windowClass.hInstance = hInstance;
//	windowClass.hIcon = LoadIcon(NULL, IDI_APPLICATION);
//	windowClass.hCursor = LoadCursor(NULL, IDC_ARROW);
//	windowClass.hbrBackground = (HBRUSH)GetStockObject(WHITE_BRUSH);
//	windowClass.lpszMenuName = NULL;
//	windowClass.lpszClassName = LPCWSTR("MyClass");
//	windowClass.hIconSm = LoadIcon(NULL, IDI_WINLOGO);
//	/*	Register window class*/
//	if (!RegisterClassEx(&windowClass))
//	{
//		return 0;
//	}
//	/*	Class registerd, so now create window*/
//	wnd = CreateWindowEx(NULL,		//extended style
//		LPCWSTR("MyClass"),			//class name
//		TEXT("A Real Win App"),		//app name
//		WS_OVERLAPPEDWINDOW |		//window style
//		WS_VISIBLE |
//		WS_SYSMENU,
//		100,100,			//x/y coords
//		400,400,			//width,height
//		NULL,				//handle to parent
//		NULL,				//handle to menu
//		hInstance,			//application instance
//		NULL);				//no extra parameter's
//	/*	Check if window creation failed*/
//	if (!wnd)
//		return 0;
//	done = false; //initialize loop condition variable
//	/*	main message loop*/
//	while(!done)
//	{
//		PeekMessage(&msg,NULL,NULL,NULL,PM_REMOVE);
//		if (msg.message == WM_QUIT) //check for a quit message
//		{
//			done = true; //if found, quit app
//		}
//		else
//		{
//			/*	Translate and dispatch to event queue*/
//			TranslateMessage(&msg); 
//			DispatchMessage(&msg);
//		}
//	}
//	return msg.wParam;
//}
//